<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 1.引入 Vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <!-- 2.准备容器 -->
    <div id="app">
      <div @click="fatherClick">
        父元素
        <button @click.stop="sonClick">子元素</button>
      </div>
      <a href="https://www.baidu.com/" @click.prevent>打开网站</a>
    </div>
    <script>
      // 3.创建Vue实例
      const app = new Vue({
        // 容器
        el: "#app",
        // 数据
        data: {
        },
        methods:{
          fatherClick(){
            alert('父元素被点击')
          },
          sonClick(){
            alert('子元素被点击')
          },
        }
      });
    </script>
  </body>
</html>